#pragma once //保证编译器只编译一个头文件一次
#ifndef SHOPROOM_HH
#define SHOPROOM_HH

#include "Room.hh"
#include "Inventory.hh"
#include "Item.hh"
#include "Player.hh"
#include <vector>
#include <string>
#include <random>
#include <unordered_set>

// The in-game shop room, where players can purchase weapons, 
// armor, or items. The store displays three products per refresh, and the 
// products are drawn from the global unique pool, and the sold products will 
// not appear again. Purchased weapons/armor are automatically equipped.

class ShopRoom : public Room {
    private:
        std::vector<Item> shopItems;
        std::unordered_set<std::string> soldItemNames;
        std::default_random_engine rng; //创建随机生成数对象

    public:
        ShopRoom()=default;
        ShopRoom(const ShopRoom& other)=default;
        ShopRoom& operator=(const ShopRoom& other)=default;
        ShopRoom(const std::string& name, const std::string& text);
        std::vector<Item> generateShopItems();
        void showShopItems() const;
        void printPlayerEquipment(const Player& player) const;
        void enterRoom(Player& player) override;
        void refreshShop(Player& player);
};

#endif

